package com.runfast.waimai.web.controller;

import com.runfast.common.utils.TokenUtil;
import com.runfast.common.web.entity.Result;
import com.runfast.waimai.dao.model.RunfastActivity;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;

import java.awt.print.Pageable;
import java.util.List;

/**
 * 红包接口
 */
@RestController("userWmRedPacketController")
@RequestMapping(value= "/api/user/wm/redPacket", headers = "token")
public class RedPacketController {

    /**
     * 获取当前用户可用的红包活动分页列表
     * @param pageable
     * @param token
     * @return
     */
    @PostMapping("/list")
    public Result<List<RunfastActivity>> list(@PageableDefault Pageable pageable, @RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }


    /**
     * 获取此订单可用的红包活动
     * @param orderId 订单id
     * @param token
     * @return
     */
    @PostMapping("/listWithOrder")
    public Result<List<RunfastActivity>> listWithOrder(@RequestParam int orderId, @RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }


    /**
     * 领取红包
     * @param redPacketId 红包活动id
     * @param token
     * @return
     */
    @PostMapping("/get")
    public Result<List<RunfastActivity>> get(@RequestParam int redPacketId, @RequestHeader String token) {
        Integer userId = TokenUtil.getUserId(token);


        return Result.ok("");
    }

}
